package org.weed.remote.network.client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class HttpClient {
	public static void main(String[] args) throws Exception {
		
		Socket client = new Socket("localhost", 80);
		BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
		String header = "GET /open/dbk/dxcompare HTTP/1.1\n"+
						"Host: localhost\n" +
						"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0" + 
						"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n" +
						"Accept-Language: en-gb,en;q=0.5\n" +
						"Accept-Encoding: gzip, deflate\n" +
						"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\n" +
						"Connection: keep-alive\n" +
						"\n";

		String line;

		writer.write(header);
		writer.flush();
		while ((line=reader.readLine())!=null) {
			System.out.println(line);
		}
	}
}
